<template>
  <div class="box">
    <div class="u-title">粉丝（{{fansList.length}}）</div>
    <div
      class="nofan"
      v-show="!isHave"
    >
      <i class="icon"></i>还没有粉丝
    </div>
    <ul v-show="isHave">
      <li
        v-for="(item,index) in fansList"
        :key="index"
      >
        <a
          href="#"
          class="ava"
        >
          <img v-lazy="item.avatarUrl">
        </a>
        <div class="info">
          <p>
            <a
              href="#"
              class="auname"
            >{{item.nickname}}</a>
            <i></i>
            <i></i>
          </p>
          <p>
            <a href="#">动态<i>{{item.eventCount}}</i></a>
            <span>|</span>
            <a href="#">关注<i>{{item.follows}}</i></a>
            <span>|</span>
            <a href="#">粉丝<i>{{item.followeds}}</i></a>
          </p>
          <p>{{item.signature}}</p>
        </div>
        <div class="oper">
          <div
            class="guan"
            v-show="item.authStatus===0"
          >
            <a
              href="#"
              class="u-btn"
            > <i class="iconfont icon-xinfeng"></i>发私信</a>
            <p class="fol"> <i class="iconfont icon-huxiang"></i>互相关注</p>
          </div>

          <p
            class="fol guaznhu"
            v-show="item.authStatus===1"
          > <i class="iconfont icon-hao"></i>关注</p>

        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data () {
    return {
      uid: 0,
      fansList: [],
      isHave: false
    }
  },
  created () {
    this.getFan();
  },
  methods: {
    async getFan () {
      this.uid = this.$route.query.id;
      let res = await axios.get('https://autumnfish.cn//user/followeds?uid=' + this.uid)
      console.log(res)
      this.fansList = res.data.followeds
      if (res.data.followeds.length !== 0) {
        this.isHave = true;
      }
    }
  }
}
</script>

<style lang="less" scoped>
a {
  text-decoration: none;
}
ul,
li {
  list-style: none;
}
ul,
p {
  margin: 0;
  padding: 0;
}
.u-title {
  border-bottom: 2px solid #c20c0c;
  height: 33px;
  font-size: 20px;
  line-height: 28px;
}
.nofan {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin-top: 100px;
  .icon {
    display: inline-block;
    margin-right: 17px;
    width: 64px;
    height: 50px;
    background-image: url(../../../assets/image/icon.png);
    background-position: 0 -347px;
    overflow: hidden;
    vertical-align: middle;
  }
}
ul {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  align-items: center;
  border-left: 1px solid #d5d5d5;
  li {
    border-bottom: 1px solid #d5d5d5;
    width: 409px;
    height: 80px;
    padding: 20px 20px 0 20px;
    border-right: 1px solid #d5d5d5;
    display: flex;
    justify-content: left;
    align-items: center;
    .ava {
      display: block;
      width: 60px;
      height: 60px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .info {
      width: 255px;
      margin-left: 10px;
      p {
        margin-bottom: 6px;
        color: #666;
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-wrap: normal;
        a {
          color: #333;
          font-size: 12px;
          i {
            font-style: normal;
            color: #0c73c2;
          }
        }
        .auname {
          display: inline-block;
          max-width: 235px;
          vertical-align: middle;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          word-wrap: normal;
          font-size: 14px;
          cursor: pointer;
          color: #0c73c2;
        }

        i {
        }
        span {
          margin: 0 8px;
          color: #999;
        }
      }
    }
    .oper {
      width: 75px;
      padding-top: 5px;
      .u-btn {
        display: inline-block;
        width: 75px;
        height: 31px;
        border: 1px solid #666;
        font-size: 12px;
        text-align: center;
        line-height: 31px;
        border-radius: 4px;
        .iconfont {
          font-size: 15px;
          color: #666;
          margin-right: 5px;
        }
      }
      .fol {
        margin-top: 5px;
        text-align: center;
        color: #999;
        font-size: 12px;
      }
      .guaznhu {
        border: 1px solid #666;
        background-color: #2172c1;
        color: #fff;
        display: inline-block;
        width: 75px;
        height: 31px;
        font-size: 12px;
        text-align: center;
        line-height: 31px;
      }
    }
  }
}
</style>
